C (183/301)

From:Rod Schnell
Date:15 Aug 99 at 21:38:28
Subject:Re: Font sizes.

From: Rod Schnell <rodsch@telusplanet.net>

Hello Lee

On 15-Aug-99, Lee Atkins wrote:
> From: Lee Atkins <lee@loonyjuicesoftware.freeserve.co.uk>
>
> Hello,
>
> Is there a way of getting the size of a font Text() will use before opening
> a window?
> I want to adjust the size of the window depending on the size of the font
> the user has selected as the system default.
> I would have thought MyScreen->RastPort.Font->tf_YSize would have done it
> (where MyScreen has been obtained from locking the default public screen)
> I can adjust the width ok using IntuiTextLength() but am stuck at getting a
> suitable size.

Usual practice is to use screen->Font->ta_YSize (screen->Font is a struct
TextAttr).

For instance,

WA_Top, screen->Font->ta_YSize + 3,

puts the window top 1 pixel below screen title bar.

(screen->Font->ta_YSize + x) * num,

figures the inner height necessary to display num lines with x spacing between
lines. If you use WA_Height to set, you'll also have to figure out the height
of upper and lower borders and that too.

Rod